package day02

/**
 * scala 语言中的
 *  to     表示的是  闭区间 , 1 到 10
 *  until  表示的是 开区间  , 1 到  9
 *
 *  Set    进行去重的操作
 */
object ForDemo {
  def main(args: Array[String]): Unit = {

    ListDemo()
  }

  private def ListDemo(): Unit = {
    for (i <- Array(12, 34, 53)) {
      println(i)
    }

    println("============================>")
    for (i <- List(12, 34, 53)) {
      println(i)
    }

    println("============================>")
    for (i <- Set(12, 12, 34, 34, 53)) {
      println(i)
    }
  }

  private def forUntilMethod(): Unit = {
    for (i <- 1 until 10) {
      println(i)
    }
  }

  private def forTOMethod(): Unit = {
    for (i <- 1 to 10 if i != 5) {
      println(i)
    }
  }
}
